<template>
    <div class="main">

            <!--<group class="group">
                <cell is-link title="提现方式" :value="chooseResult" @click.native="onClick"></cell>
            </group>
            <p class="s-tip">
                注：单笔提现金额不少于100元，不大于6000元<br>
                使用银联支付提现，每笔收取1%手续费
            </p>-->
            <!--<group>
                <x-input required ref="score" title="金币佣金" keyboard="number" v-model="score" placeholder="请输入金币佣金"></x-input>
                <x-input required ref="gem" title="钻石佣金" keyboard="number" v-model="gem" placeholder="请输入钻石佣金"></x-input>
                &lt;!&ndash;<x-input required title="提现密码" type="password" v-model="password" placeholder="请输入提现密码(即登陆密码)"></x-input>&ndash;&gt;
            </group>-->
            <!--<p class="s-tip">
                可提现余额：￥{{withdrawalMoney}}
            </p>-->
            <button class="dis-b" type="button" @click="getMoney">申请提现</button>
            <!--<actionsheet v-model="show" :menus="menu" @on-click-menu="choose" show-cancel></actionsheet>-->
            <toast width="70%" v-model="toast" type="text" :time="1500" is-show-mask :text="text" position="default"></toast>

    </div>
</template>

<script>
    import { Actionsheet, XInput  } from 'vux'
    import util from "../../fetch/util";

    export default {
        name: "withdrawalMoney",
        components: {
            Actionsheet,
            XInput,
        },
        data(){
            return {
                /*show: false,
                chooseResult: '请选择',
                menu: {},
                money: '',
                password: '',
                withdrawalMoney: 0,     // 可提现金额*/
                /*moneyCheck: function (val) {
                    return {
                        valid: Number(val) < 6000 && Number(val) > 100,
                        msg: '提现金额不得少于100元，不得大于6000元'
                    }
                }*/
                score: '',
                gem: '',
                toast: false,
                text: '',
            }
        },
        methods: {
            /*getData(){
                let arr = ['微信钱包','支付宝'];
                for(let key in arr){
                    this.menu['menu' + (key + 1)] = arr[key];
                }


            },
            onClick(){
                this.show = true;
            },
            choose(key,val){
                if(key !== 'cancel'){
                    this.chooseResult = val;
                }else{
                    this.chooseResult = '请选择';
                }
            },*/
            // 提现
            getMoney(){
                let id = JSON.parse(localStorage.getItem('userInfo')).id;
                let params = {
                    id: id,
                    //score: this.score,
                    //gem: this.gem
                    score: 0,
                    gem: 0
                }
                util.fetchGet(util.path.cash,params).then((data)=>{
                    this.toast = true;
                    if(data.code == 0){
                        this.text = data.data;
                    }else{
                        this.text = data.msg;
                    }
                });

                //alert(this.password)
            }
        },
        /*mounted:function () {
            this.getData();
        }*/
    }
</script>

<style scoped>
    .x-header{
        border-bottom: #ddd 1px solid;
    }
    .s-tip{
        font-size: 12px;
        color: #b8b8b8;
        margin: 8px;
    }
    button{
        width: 90%;
        margin: 20px auto;
        background: #2baee9;
        color: #fff;
        line-height: 40px;
        border-radius: 4px;
        font-size: 16px;
    }
</style>
